package com.bizfx.component.presenters
{
	import flash.display.DisplayObject;
	
	import com.bizfx.component.controls.PopUpProgressBarManager;
	import com.bizfx.component.views.SimpleTreeNavigator;
	import com.bizfx.events.NavigatorDataLoadedEvent;
	import com.bizfx.events.NavigatorSelectionChangedEvent;
	
	public class SimpleTreeNavigatorPresenter extends BaseNavigatorPresenter
	{
		public function SimpleTreeNavigatorPresenter() {
			super();
		}
		
		override protected function navigatorDataLoadedHandler(event:NavigatorDataLoadedEvent):void
		{
			super.navigatorDataLoadedHandler(event);
			PopUpProgressBarManager.hide(this.view as DisplayObject);
		}
		
		override protected function viewSelectionChangedHandler(event:NavigatorSelectionChangedEvent):void
		{
			if (!event.newItem.isLeaf && !event.newItem.hasLoadedChildren)
			{
				PopUpProgressBarManager.show(null, this.view as DisplayObject);
			}
			super.viewSelectionChangedHandler(event);
		}
	}
}